package com.wry.cloud.service.impl;

import com.wry.cloud.entity.Payment;
import com.wry.cloud.service.OrderService;
import com.wry.cloud.utils.ApiResult;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * <h1>  <h1>
 *
 * @author 魏如元
 * @since 2022/9/5
 */
@Service
public class OrderServiceImpl implements OrderService {

    @Resource
    private RestTemplate restTemplate;

    @Value("${payment.url.jq}")
    private String PAYMENT_URL;

    @Override
    public ApiResult<?> selectPayment(Long id) {
        return restTemplate.getForObject(PAYMENT_URL+id,ApiResult.class);
    }

    @Override
    public ApiResult<?> insetPayment(Payment payment) {
        return restTemplate.postForObject(PAYMENT_URL, payment, ApiResult.class);
    }
}
